#define _CRT_SECURE_NO_WARNINGS
#define N 10
#include<stdio.h>
int main()
{
	int a[N] = { 1,6,4,8,3,2,9,10,7,5 };
	
	int i = 0;

	for (i = 0; i < N; i++)
	{
		printf("%d ",a[i]);
	}

	printf("\n");

	for (i = 0; i < N-1; i++)
	{
		int max = i;
		int j = 0;
		for (j = i +1; j < N; j++)
		{
			if (a[j] > a[max])
			{
				max = j;
			}
		}

		if (max != i)
		{
			int tmp = a[i];
			a[i] = a[max];
			a[max] = tmp;
		}

	}



	for (i = 0; i < N; i++)
	{
		printf("%d ", a[i]);
	}

	printf("\n");
	return 0;
}